package org.dromara.web.controller.app;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import org.dromara.common.core.domain.R;
import org.dromara.web.controller.app.req.CommitFeedbackReq;
import org.dromara.web.controller.app.req.TextToImageBody;
import org.dromara.web.service.business.FeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 *  提交反馈
 *
 */
@RestController
@RequestMapping("/app/feedback")
public class AppFeedbackController {

    @Autowired
    FeedbackService feedbackService;


    /**
     *  提交反馈
     *
     * @param req
     * @return
     */
    @Operation(
        requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
            content = @Content(
                schema = @Schema(implementation = CommitFeedbackReq.class)
            )
        )
    )
    @PostMapping("/commit")
    public R<Void> commit(@RequestBody @Validated CommitFeedbackReq req) {
        feedbackService.commitFeedback(req.getContent(), req.getImages(), req.getEmail());
        return R.ok();
    }
}
